package com.aps.server.service;

import com.aps.algorithm.entity.ApsKpiTemplate;
import com.aps.algorithm.mapper.ApsKpiTemplateMapper;
import com.aps.common.service.TestGenericService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * @Author nbZhuozh
 * @Date 2025-11-21  10:03
 **/
@Service
public class ApsSystemConfigrationService extends TestGenericService {

    @Resource
    ApsKpiTemplateMapper apsKpiTemplateMapper;


    /**
     * 查询kpi模板配置
     * @return
     */
    public List<ApsKpiTemplate> queryKpiTemplateConfig(){
        LambdaQueryWrapper<ApsKpiTemplate> eq = new LambdaQueryWrapper<>(ApsKpiTemplate.class)
                .eq(ApsKpiTemplate::getTenantId, getCurrentTenantId());
        List<ApsKpiTemplate> apsKpiTemplates = apsKpiTemplateMapper.selectList(eq);
        if(CollectionUtils.isEmpty(apsKpiTemplates)){
            return Collections.emptyList();
        }
        //按行业模板分组 （大模板） 和 具体 规则
        return apsKpiTemplates;
    }


}
